<template>
	<view class="customer">

		<view v-if="list.length > 0">
			<view class="customer_list">
				<view class="customer_list_item first" v-for="(item, index) in list" :key="index">
					<view class="phone">
						{{ item.cusName }}
					</view>

					<view>
						<view>电话</view>
						<view class="num">{{ item.cusMobile }}</view>
						<view @tap="makePhoneCall(item.cusMobile)" class="btn">拨打</view>
					</view>
					<view class="weixin">
						<view>微信</view>
						<view class="num">{{ item.cusWeixin }}</view>
						<view @tap="copy" class="btn">复制</view>
					</view>
				</view>

			</view>
		</view>
		<view v-else>
			<u-divider textSize="34" text="暂无数据"></u-divider>
		</view>
		<!-- <view style="margin: auto; width: 100%; text-align: center;" v-else>~ 暂无数据 ~</view> -->

	</view>
</template>

<script>
export default {
	data() {
		return {
			list: []
		};
	},
	methods: {
		copy() {
			uni.showToast({
				title: "已复制",
				icon: "none"
			})
		},
		makePhoneCall(tel) {
			uni.makePhoneCall({
				phoneNumber: tel
			})
		}
	},
	onShow() {
		this.$api.qryCustomerServiceApi().then((res) => {
			if (res.code == 200) {
				this.list = res.result.list
			}
		});
	},
};
</script>

<style lang="scss" scoped>
page {
	background: #f1f1f1;
}

.customer {
	height: 100vh;
	background-color: #f1f1f1;
	padding: 26rpx;

	.header_btn {
		display: flex;

		button {
			height: 58rpx;
			line-height: 58rpx;
			background: #fe3430;
			bcustomer-radius: 49rpx;
			color: #fff;
			margin-left: 0;
			margin-right: 10rpx;
		}
	}

	.customer_list {
		.customer_list_item {
			background-color: #fff;
			border-radius: 20rpx;
			margin-top: 10rpx;
			padding: 10rpx;

			&>view {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 22rpx 26rpx 15rpx 51rpx;

				.btn {
					border-radius: 29rpx;
					background: #fe3430;
					width: 124rpx;
					height: 49rpx;
					line-height: 49rpx;
					color: #fff;
					text-align: center;
				}

				.num {
					color: #bdbdbd;
					margin-left: -43rpx;
				}
			}

			.phone {
				border-bottom: 1px solid #bdbdbd;
			}

			.first {
				margin-top: 5rpx;
			}
		}
	}
}
</style>
